<?php
/*
 * @ https://EasyToYou.eu - IonCube v11 Decoder Online
 * @ PHP 7.2 & 7.3
 * @ Decoder version: 1.1.6
 * @ Release: 10/08/2022
 */

// Decoded file for php version 71.
namespace OSS\Tests;

require_once __DIR__ . "/../../../autoload.php";
class Common
{
    public static function getOssClient()
    {
        try {
            $ossClient = new \OSS\OssClient(getenv("OSS_ACCESS_KEY_ID"), getenv("OSS_ACCESS_KEY_SECRET"), getenv("OSS_ENDPOINT"), false);
        } catch (\OSS\Core\OssException $e) {
            printf("getOssClientcreating OssClient instance: FAILED\n");
            printf($e->getMessage() . "\n");
            return NULL;
        }
        return $ossClient;
    }
    public static function getBucketName()
    {
        return getenv("OSS_BUCKET");
    }
    public static function createBucket()
    {
        $ossClient = self::getOssClient();
        if(is_null($ossClient)) {
            exit(1);
        }
        $bucket = self::getBucketName();
        $acl = \OSS\OssClient::OSS_ACL_TYPE_PUBLIC_READ;
        try {
            $ossClient->createBucket($bucket, $acl);
        } catch (\OSS\Core\OssException $e) {
            printf("createBucket: FAILED\n");
            printf($e->getMessage() . "\n");
            return NULL;
        }
        echo "createBucket: OK\n";
    }
    public static function waitMetaSync()
    {
        if(getenv("TRAVIS")) {
            sleep(10);
        }
    }
}

?>